home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HAM Radio 3.2
/
Ham Radio Version 3.2 (Chestnut CD-ROMs)(1993).ISO
/
exam
/
easyqbe
/
easyqbe.prg
< prev
next >
Wrap
Text File
|
1985-12-19
|
10KB
|
337 lines
***************************************************************************
* Program.: EASYQBE.PRG
* Author..: Robert P. Hermans
* Date....: 12/09/85
* Notice..: Donated to the Public Domain
* Version.: dBASE III, version 1.1,Plus,Developer's Version.
* Notes...: Interrogation program for CONTRIB.dbf
*
***************************************************************************
SET TALK OFF
SET SAFETY OFF
STORE ":INTERROGATION:SELECT FROM CONDITIONS BELOW:" to SCREENSAY
* OPEN WORK AREAS WITH NEEDED FILES
* PRIMARY FILE TO BE INTERROGATED
SELECT 1
USE CONTRIB.DBF
* NOTE:FILE IS USED WITHOUT INDEX.. THIS SPEEDS UP SEQUENTIAL INTERROGATION OF
* FILE...IF NEED IS FOR AN ALPHABETICAL OR SOME OTHER INDEX ORDER LISTING
* SET REQUIRED INDEX(ES) ON.
* WORK FILE
SELECT 3
USE SELECT
* ZERO THE FILE FROM ANY PREVIOUS INTERROGATIONS
ZAP
* CREATE A BLANK RECORD
APPEND BLANK
* NOTE:I HAVE A PREFERENCE FOR USING A FILE AS OPPOSED TO MEMORY VARIABLES
* THIS IS SUBJECTIVE..USE MEMORY VARIABLES IF YOU PREFER
* CLEAR THE SCREEN
CLEAR
* SET UP A LOOP
DO WHILE .T.
SET COLOR TO /W
@ 3,40-(LEN(SCREENSAY)/2) SAY SCREENSAY
SET COLOR TO W/
* INITIATE SEARCH STRING
S="FOR "
* SET UP AN INPUT FRAME.
* (THE FOLLOWING WAS DONE WITH VIEWGEN(tm).. [LUIS CASTRO])
@ 4, 7 SAY "==============================================================="
@ 5, 7 SAY "|"
@ 5,69 SAY "|"
@ 6, 7 SAY "|"
@ 6,69 SAY "|"
@ 7, 7 SAY "|"
@ 7,69 SAY "|"
@ 8, 7 SAY "|"
@ 8,69 SAY "|"
@ 9, 7 SAY "|"
@ 9,69 SAY "|"
@ 10, 7 SAY "|"
@ 10,69 SAY "|"
@ 11, 7 SAY "|"
@ 11,69 SAY "|"
@ 12, 7 SAY "|"
@ 12,69 SAY "|"
@ 13, 7 SAY "|"
@ 13,69 SAY "|"
@ 14, 7 SAY "|"
@ 14,69 SAY "|"
@ 15, 7 SAY "|"
@ 15,69 SAY "|"
@ 16, 7 SAY "|"
@ 16,69 SAY "|"
@ 17, 7 SAY "|"
@ 17,69 SAY "|"
@ 18, 7 SAY "==============================================================="
@ 5,20 SAY "City OF:"
@ 5,46 SAY "State OF:"
@ 7,13 SAY "Zip-Code GTE:"
@ 7,40 SAY "Zip_Code LTE:"
@ 9,13 SAY "Activity Code (1) OF:"
@ 9,39 SAY "Activity Code (2) OF:"
@ 11,11 SAY "Contributed YTD GTE:"
@ 11,39 SAY "Contributed YTD LTE:"
@ 13,20 SAY "Last Contribution ON or AFTER:"
@ 15,19 SAY "Last Contribution ON or BEFORE:"
@ 17,24 SAY "Solicitors NAME:"
@ 19, 7 SAY "==============================================================="
@ 20, 7 SAY "|"
@ 20,69 SAY "|"
@ 21, 7 SAY "==============================================================="
@ 20, 8 SAY "LEAVE ALL FIELDS BLANK & PRESS F1 TO EXIT............."
* NOW OFFER USER THE INPUT FIELDS
@ 5,28 GET CITY pict "!!!!!!!!!!!!!!!!"
@ 5,55 GET STATE pict "!!"
@ 7,26 GET ZIPGTE pict "99999X9999"
@ 7,53 GET ZIPLTE pict "99999X9999"
@ 9,34 GET ACT_1 pict "!!!"
@ 9,60 GET ACT_2 pict "!!!"
@ 11,31 GET YR_TO_DGTE pict "9999.99"
@ 11,59 GET YR_TO_DLTE pict "9999.99"
@ 13,52 GET DATEGTE
@ 15,52 GET DATELTE
@ 17,40 GET SOLICITOR pict "!!!!!!!!!!!!!!!"
READ
CLEAR GETS
* NOW CHECK THE USER ENTRY AND START BUILDING THE INTERROGATION PARAMETERS
* NOTE THAT '.AND.' IS TAGGED ONTO THE END OF EACH INTERROGATION PARAMETER
* AND IS TRIMMED (SEE BELOW) BEFORE THE INTERROGATION COMMENCES.
* RECALL THAT THE VARIABLE 'S'= 'FOR'.
* IF THE USER INPUT A CITY
IF CITY <> " "
S=S+"UPPER(CITY)="+"'"+TRIM(CITY)+"'.AND."
* NOTE THAT THE PICTURE INPUT IS UPPER CASE AND THE SEARCH PARAMETER
* IS UPPER CASE...
ENDIF
* IF THE USER INPUT A STATE
IF STATE <> " "
S=S+"STATE='"+STATE+"'.AND."
ENDIF
* IF USER INPUT A ZIP CODE GTE (>=)
IF VAL(ZIPGTE) <> 0
S=S+"TRIM(ZIP)>='"+TRIM(ZIPGTE)+"'.AND."
ENDIF
* IF USE INPUT A ZIP CODE LTE (<=)
IF VAL(ZIPLTE) <> 0
S=S+"TRIM(ZIP)<='"+TRIM(ZIPLTE)+"'.AND."
ENDIF
* IF USER ENTERED ACTIVITY CODE 1 DATA
IF ACT_1 <> " "
S=S+"ACT_1='"+ACT_1+"'.AND."
ENDIF
* IF USER ENTERED ACTIVITY CODE 2 DATA
IF ACT_2 <> " "
S=S+"ACT_2='"+ACT_2+"'.AND."
ENDIF
* IF USER ENTERED AN AMOUNT GTE
IF YR_TO_DGTE > 0
S=S+"YR_TO_DATE>="+STR(YR_TO_DGTE,7,2)+" .AND."
ENDIF
* IF USER ENTERED AN AMOUNT LTE
IF YR_TO_DLTE> 0
S=S+"YR_TO_DATE<="+STR(YR_TO_DLTE,7,2)+" .AND."
ENDIF
* IF A 'BEFORE DATE' WAS ENTERED
IF LEN(TRIM(DTOC(DATEGTE))) =8
S=S+"DATE>=CTOD('"+DTOC(DATEGTE)+"') .AND."
ENDIF
* IF AN `AFTER DATE' WAS ENTERED
IF LEN(TRIM(DTOC(DATELTE))) =8
S=S+"DATE<=CTOD('"+DTOC(DATELTE)+"') .AND."
ENDIF
* AND THE FINAL INPUT FIELD, IF THE USER ENTERED A SOLICTOR
IF SOLICITOR <> " "
S=S+"UPPE(SOLICITOR)='"+TRIM(SOLICITOR)+"'.AND."
ENDIF
* NOW THAT ALL USER INPUT FIELDS HAVE BEEN READ, CHECK TO SEE IF USER
* INPUT ANY DATA..RECALL THAT ALL FIELDS BLANK MEANS 'EXIT'
IF LEN(TRIM(S))=3
* i.e. If 'S' = "FOR" USER DID NOT ENTER ANYTHING IN ANY FIELDS
CLOSE DATA
CLEAR
RETURN
ENDIF
* OTHERWISE THE USER MUST HAVE ENTERED DATA.
* SO TRIM OFF THE '.AND.' WHICH IS ON THE END OF EACH PARAMETER
STORE SUBSTR(S,1,(LEN(S)-5)) TO SELECTOR
* GIVEN THE 250 CHARACTER LINE LIMIT CHECK THAT THE LINE DOES NOT EXCEED
* 220.....220 IS USED AS THE MACRO WILL BECOME PART OF A LONGER SYNTAX
* STRING BELOW.
IF LEN(TRIM(SELECTOR)) > 220
WAIT "TOO MANY CONDITIONS SELECTED !..PRESS ANY KEY AND REVISE......."
CLEAR
LOOP
ENDIF
**
* WE NOW HAVE A VALID SEARCH STRING MACRO 'SELECTOR' SO OFFER THE USER
* THE ABILITY TO REDIRECT OR COUNT THE NUMBER OF RECORDS SATISFYING
* THE PARAMETERS ENTERED.
* HERE'S WHERE THE ACTUAL INTERROGATION GOES......
* USE WILL SELECT LIST TO SCREEN, COPY TO WORDSTAR, OR TO A DBASE OR
* PROGRAMMER GENERATED REPORT...
CLEAR
*SET UP A LOOP
STORE .T. TO INTEROGATE
DO WHILE INTEROGATE
CLEAR
SET COLOR TO /W
@ 3,40-(LEN(SCREENSAY)/2) SAY SCREENSAY
SET COLOR TO W/
STORE "?" TO CHOICE
* OFFER THE USER A CHOICE...OBVIOUSLY THESE CHOICES COULD BE EXPANDED OR
* MODIFIED TO INCLUDE A LABEL FILE OR TRANSFER OF .DBF DATA TO ANOTHER
* .DBF FILE OR 1-2-3 OR OTHER PROGRAM.
@ 7,18 SAY "PLEASE SELECT YOUR CHOICE:"
@ 9,18 SAY "C)OUNT THE NUMBER OF CONTRIBUTORS SELECTED"
@ 10,18 SAY "L)IST THE SELECTED CONTRIBUTORS TO THE SCREEN"
@ 11,18 SAY "R)EPORT OF THE SELECTED CONTRIBUTORS"
@ 12,18 SAY "W)ORDSTAR FILE OF THE SELECTED CONTRIBUTORS"
@ 13,18 SAY "Q)UIT & ABORT THIS INTERROGATION"
DO WHILE .NOT. CHOICE $ "CLRWQ"
@ 15,18 SAY "C)OUNT - L)IST - R)EPORT - W)ORDSTAR - Q)UIT?" GET ;
CHOICE PICT "!"
READ
CLEAR GETS
ENDDO GET CHOICE
* USE A CASE TO EXECUTE THE DESIRED INTERROGATIONS UNTIL USER
* SELECTS 'Q' TO QUIT INTERROGATION.......
DO CASE
CASE CHOICE = "Q"
EXIT
* THIS WILL REFRESH SCREEN FOR NEW INTERROGATION PARAMETERS
* OR EXIT TO CALLING PROGRAM OR SYSTEM.
CASE CHOICE = "L"
* LIST TO SCREEN - THIS PROGRAM USES A DBASE III REPORT FORM
* COULD ALSO USE 'DISPLAY FOR &SELECTOR'
* SELECT PRIMARY FILE AREA
* NOTE THAT AN INDEX COULD BE USED TO PROVIDE AN ORDERED LISTING
* OR DISPLAY...IT WILL, HOWEVER, SLOW DOWN EXECUTION
SELECT 1
* ERASE THE SCREEN AND TELL USER HOW TO PAUSE THE DISPLAY
CLEAR
? "USE CTRL+'S' TO PAUSE AND RESUME THE SCREEN DISPLAY"
WAIT
REPO FORM SUBMAIN5 PLAIN &SELECTOR
? "THAT'S ALL OF THE RECORDS....................."
WAIT
* SELECT WORK FILE AREA
SELECT 3
LOOP
CASE CHOICE = "C"
* MEANS USER WANTS TO COUNT THE NUMBER OF RECORDS SATISFYING
* THE PARAMTERS ENTERED........
* SELECT THE PRIMARY FILE AREA
SELECT 1
COUNT TO NUMSELECT &SELECTOR
* CLEAR THE SCREEN AND TELL THE USER HOW MANY RECORDS
CLEAR
? "THE NUMBER OF RECORDS SELECTED IS:"+STR(NUMSELECT,5)
WAIT
* RETURN TO WORK FILE AREA
SELECT 3
LOOP
CASE CHOICE= "R"
* USER WANTS A REPORT
CLEAR
WAIT "PLEASE READY THE PRINTER.. PRESS ANY KEY WHEN READY ;
OR 'Q' TO QUIT" TO WHAT
IF UPPER(WHAT)="Q"
LOOP
ENDIF
* PRINT THE REPORT
SET CONSOLE OFF
SELECT 1
REPO FORM SUBMAIN3 TO PRINT &SELECTOR
SET CONSOLE ON
* RETURN TO WORK FILE AREA
SELECT 3
CLEAR
LOOP
CASE CHOICE = "W"
* USER WANTS A MERGE FILE - FOLLOWING IS FOR WORDSTAR (tm)
* ADAPT DELIMITERS ACCORDING TO MERGE PROGRAM REQUIREMENTS
SELECT 1
COPY TO MERGE.TXT DELI WITH " &SELECTOR
* TELL USER THE NAME OF THE '.TXT' FILE (NOTE PROGRAM COULD BE
* MODIFIED FOR USER INPUT OF FILE NAME)
CLEAR
? "SELECTED RECORDS(IF ANY) HAVE BEEN COPIED TO A WORDSTAR FILE ;
'MERGE.TXT'"
WAIT
* RETURN TO WORK FILE AREA
SELECT 3
LOOP
ENDCASE
ENDDO INTRGATE
* MOVE TO WORK FILE AREA AND RESET THE FILE FOR THE NEXT INTERROGATION(IF)]
SELECT 3
ZAP
APPE BLANK
CLEAR
ENDDO
* EOF EASYQBE.PRG